﻿using System.Collections.Generic;
using K9Nano.Application.Api;
using K9Nano.Authorization;
using K9Nano.Share;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace K9Nano.AspNetCore.Api
{
    [ApiController]
    [Authorize(Policy = K9SharedConstants.PolicyTenantAdmin)]
    [Route("ApiResource/[Action]")]
    public class ApiResourceController: ControllerBase
    {
        private readonly IApiResourceAppService _service;

        public ApiResourceController(IApiResourceAppService service)
        {
            _service = service;
        }

        [HttpGet]
        public IReadOnlyList<IApiResource> GetAll()
        {
            return _service.GetResources();
        }
    }
}